﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CLVisionMES
{
    internal class MqttMesClientFactory
    {
        public static IMqttMesClient CreateMQTTClient()
        {
            IMqttMesClient mqttMesClient = null;
            /////************************  判断参数是NC还是TS  ****************************
            //当前类的类型
            Type type = typeof(MqttMesClientFactory);
            //获取dll的当前路径
            string path = type.Assembly.Location;
            //dll所在文件夹
            string currentDirPath = Path.GetDirectoryName(path);

            if (currentDirPath.Contains("Ncheck"))  //路径含有Ncheck是NC
            {
                mqttMesClient = new MqttMesClientNC();
            }
            else if (currentDirPath.Contains("V:\\Std\\OMS\\TestSteps"))
            {
                mqttMesClient = new MqttMesClientTS();
            }

            return mqttMesClient;
        }
    }
}
